﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:UX="clr-namespace:DDU.UX;assembly=DDU.UX"
    xmlns:es="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing" 
    xmlns:viewmodel="clr-namespace:DDU.ViewModel;assembly=DDU.ViewModel"
    x:Class="DDU.Curriculum.Views.ActivitiesView"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False" >

    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush ImageSource="/Assets/back.png"/>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.DataContext>
            <viewmodel:ActivitiesViewModel/>
        </Grid.DataContext>

        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{StaticResource IDS_APP_NAME}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="活动列表" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <UX:UXPathButton Uri="/Views/ActivityAddView.xaml" 
                         VerticalAlignment="Bottom" 
                         HorizontalAlignment="Right" 
                         Padding="13" 
                         Margin="12,12,24,40" 
                         IconPath="{StaticResource PATH_ICON_CLOSE}" 
                         Angle="45" />

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <ListBox ItemsSource="{Binding Path=ItemsOfActivities}">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="ListBoxItem">
                                    <Grid MinHeight="80" Margin="12,0">
                                		<Grid.ColumnDefinitions>
                                			<ColumnDefinition Width="auto"/>
                                			<ColumnDefinition Width="20"/>
                                			<ColumnDefinition/>
                                		</Grid.ColumnDefinitions>
                                		<VisualStateManager.VisualStateGroups>
                                			<VisualStateGroup x:Name="SelectionStates">
                                				<VisualState x:Name="Unselected"/>
                                				<VisualState x:Name="Selected">
                                					<Storyboard>
                                						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="uXPathButton">
                                							<DiscreteObjectKeyFrame KeyTime="0">
                                								<DiscreteObjectKeyFrame.Value>
                                									<Visibility>Collapsed</Visibility>
                                								</DiscreteObjectKeyFrame.Value>
                                							</DiscreteObjectKeyFrame>
                                						</ObjectAnimationUsingKeyFrames>
                                						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="uXPathButtonEdit">
                                							<DiscreteObjectKeyFrame KeyTime="0">
                                								<DiscreteObjectKeyFrame.Value>
                                									<Visibility>Visible</Visibility>
                                								</DiscreteObjectKeyFrame.Value>
                                							</DiscreteObjectKeyFrame>
                                						</ObjectAnimationUsingKeyFrames>
                                					</Storyboard>
                                				</VisualState>
                                				<VisualState x:Name="SelectedUnfocused"/>
                                			</VisualStateGroup>
                                		</VisualStateManager.VisualStateGroups>
                                		<Grid>
                                			<Grid.RowDefinitions>
                                				<RowDefinition Height="12"/>
                                				<RowDefinition Height="48"/>
                                				<RowDefinition />
                                			</Grid.RowDefinitions>
                                			<Rectangle Width="2" Fill="{StaticResource PhoneSubtleBrush}"/>
                                			<UX:UXPathButton x:Name="uXPathButton" Grid.Row="1" IconPath="{StaticResource PATH_ICON_REALTIME}"/>
                                			<UX:UXPathButtonWithParam ParameterName="guid" 
                                                                      ParameterValue="{Binding Guid}" 
                                                                      x:Name="uXPathButtonEdit" 
                                                                      Grid.Row="1" 
                                                                      IconPath="{StaticResource PATH_ICON_EDIT}" 
                                                                      Visibility="Collapsed" 
                                                                      Uri="/Views/ActivityEditView.xaml"/>
                                			<Rectangle Width="2" Grid.Row="2" Fill="{StaticResource PhoneSubtleBrush}"/>
                                		</Grid>
                                    	
										<Grid Grid.Column="1" VerticalAlignment="Top" Height="48" Margin="0,12,0,0">
											<es:BlockArrow Fill="{StaticResource PhoneSubtleBrush}" Orientation="Left" UseLayoutRounding="False" StrokeThickness="0" HorizontalAlignment="Right" VerticalAlignment="Center" Width="12" Height="18" ArrowBodySize="0" ArrowheadAngle="53"/>
										</Grid>

                                        <Border Grid.Column="2" Margin="0,18,0,0" Background="{StaticResource PhoneSubtleBrush}" CornerRadius="5">
                                            <StackPanel Margin="0,12">
                                                <TextBlock Text="{Binding Title}" Style="{StaticResource PhoneTextTitle3Style}" Foreground="{StaticResource PhoneChromeBrush}" />
                                                <Rectangle Height="1" Margin="12,6" Fill="{StaticResource PhoneForegroundBrush}"/>
                                                <TextBlock Text="{Binding Content}" Style="{StaticResource PhoneTextNormalStyle}" Foreground="{StaticResource PhoneSemitransparentBrush}" />
                                                <TextBlock Style="{StaticResource PhoneTextNormalStyle}" Foreground="{StaticResource PhoneSemitransparentBrush}">
                                                    <Run Text="{Binding StartTime,StringFormat=\{0:yyyy-MM-dd HH:mm\}}"/>
                                                    <Run Text=" - "/>
                                                    <Run Text="{Binding EndTime,StringFormat=\{0:MM-dd HH:mm\}}"/>
                                                </TextBlock>
                                            </StackPanel>
                                        </Border>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListBox.ItemContainerStyle>
                
            </ListBox>
        </Grid>
        
    </Grid>
 
    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>
